PSIONICS FILE - WORD.FMT ======================== Format of Word files Last modified 1994-02-26 ======================== A word file begins with a header of the following form: Offset 0 (cstr): "PSIONWPDATAFILE" Offset 16 (word): format version number Offset 18 (word): 0 (meaning unknown) Offset 20 to 37: all $EA (meaning unknown) Offset 38 (word): 0 (meaning unknown) The only format version number seen is 1. The rest of the file consists of records. All records have the form: Offset 0 (word): record type Offset 2 (word): size of data portion (L) Offset 4 to L+3: data portion All word files seen have record types 1 to 9. The records always occur in numerical order of type. Exactly one record of each type is seen, except that there may be more than one record of types 6 and 7. All distances and font sizes are in units of 0.05 points (i.e. a value of 1440 represents one inch). All font names are represented by standard code numbers: 0 = Pica 2 = Elite 24 = Proportional -1 = Inherited (where permitted) Record type 1 holds information about the file. It is always 10 bytes: Offset 0 (word): cursor position within text record (type 8) Offset 2 (byte): each set bit indicates a character type should be shown as symbols (see Psion-H): Bit 0: tabs Bit 1: spaces Bit 2: carriage returns Bit 3: soft hyphens Bit 4: forced line breaks Bits 5 to 7: unused, always zero Offset 3 (byte): unknown, always zero Offset 4 (byte): 0=style bar off, 1=style bar on (see Psion-Q) Offset 5 (byte): 0=file type is paragraph, 1=file type is line (see Psion-Q) Offset 6 (byte): outlining level Offset 7 (byte): unknown, always 1 Offset 8 (word): unknown, always 2 Record type 2 holds information about printer set-up (see Psion-Y). It is always 58 bytes: Offset 0 (word): page width Offset 2 (word): page height (Note: the above fields and the corresponding sub-dialog assume that the paper orientation is "portrait") Offset 4 (word): left margin Offset 6 (word): top margin Offset 8 (word): distance between left and right margins Offset 10 (word): distance between top and bottom margins (Note: these four fields have only been checked for portrait) Offset 12 (word): header offset Offset 14 (word): footer offset Offset 16 (byte): paper orientation: 0=portrait, 1=landscape Offset 17 to 23: unknown (always 0, 0, 0, 1, 0, $FF, $FF) Offset 24 (word): header font code number Offset 26 (byte): header style Bit 0: underline Bit 1: bold Bit 2: italic Bit 3: superscript Bit 4: subscript Bits 5 to 7: unused, always zero Offset 27 (byte): unknown, always zero Offset 28 (word): header font size Offset 30 (byte): header alignment: 0 = left 1 = right 2 = centered 3 = justified 4 = two column 5 = three column Offset 31 (byte): header on first page: 0=no, 1=yes Offset 32 to 39: as 24 to 31, but apply to footer, not header Offset 40 (word): page number of first page minus 1 Offset 42 (word): unknown, always zero Offset 44 (byte): page number style: 0="1,2,3", 1="I,II,III", 2="i,ii,iii" Offset 45 to 52: unknown (0, 0, 0, 0, 0, $F0, 0, 0) Offset 53 (byte): widows/orphans allowed: 0=no, 1=yes Offset 54 (long): unknown, always zero Record type 3 holds information about the printer driver: Offset 0 (byte): printer driver model number Offset 1 (cstr): printer driver library A printer driver library can support several similar printers; the model number specifies which is selected. Record types 4 and 5 hold cstrs giving the header and footer text respectively. Record types 6 and 7 have a similar layout. Record type 6 describes a style and uses all 80 bytes. Record type 7 describes an emphasis and uses only the first 28 bytes. Offset 0 to 1: short code, as uppercase letters Offset 2 (cstr): full name Offset 18 (word): not fully known, but it appears that: Bit 0: set for emphases, clear for styles Bit 1: set for default style/emphasis, otherwise clear Bit 2: set for default style/emphasis, otherwise clear Offset 20 (word): font code number Offset 22 (byte): style Bit 0: underline Bit 1: bold Bit 2: italic Bit 3: superscript (available in emphasis only) Bit 4: subscript (available in emphasis only) Bits 5 to 7: unused, always zero Offset 23 (byte): unknown Offset 24 (word): font size Offset 26 (byte): Bit 0: inherit underline setting Bit 1: inherit bold setting Bit 2: inherit italic setting Bits 3 to 7: unused, always zero Offset 27 (byte): unused, always zero Offset 28 (word): left indent Offset 30 (word): right indent Offset 32 (word): first line indent Offset 34 (word): alignment: 0=left, 1=right, 2=centred, 3=justified Offset 36 (word): line spacing Offset 38 (word): space above Offset 40 (word): space below Offset 42 (byte): spacing controls: Bit 0: set to keep with next Bit 1: set to keep together Bit 2: set to start new page Offset 43 (byte): unused, always zero Offset 44 (word): Outline level (1 to 9) Offset 46 (word): number of tab stops set Offset 48 (word): position of first tab stop Offset 50 (word): type of first tab stop: 0=left, 1=right, 2=centred Offset 52 to 55: as offsets 48 to 51 for second tab stop Offset 56 to 79: as offsets 48 to 51 for third to eighth tab stops Record type 8 holds the actual text, in the form of one cstr for each paragraph, with no separator. Record type 9 consists of a sequence of blocks giving the style and emphasis for the text; each block covers some number of consecutive bytes, and the blocks between them cover the entire text. No block crosses a paragraph boundary, but the last block of the paragraph includes the terminating zero of the cstr in its length. Each block is 6 bytes: Offset 0 (word): number of bytes covered Offset 2 to 3: shortcode of style applied Offset 4 to 5: shortcode of emphasis applied -- Clive D.W. Feather | Santa Cruz Operation | If you lie to the compiler, clive@sco.com | Croxley Centre | it will get its revenge. Phone: +44 923 816 344 | Hatters Lane, Watford | - Henry Spencer Fax: +44 923 210 352 | WD1 8YN, United Kingdom |